#include <assert.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#define DEV "/dev/null"


void GA_thread(const char* curr = nullptr)
{
    signal(SIGPIPE, SIG_IGN);

    if (fork() > 0)
        exit(0);
    pid_t n = setsid();
    assert(n != -1);

    int fd = open(DEV,O_RDWR);
    if(fd >= 0){
        dup2(fd,0);
        dup2(fd,1);
        dup2(fd,2);
        close(fd);

    }else{
        close(0);
        close(1);
        close(2);

    }
    if(!curr)chdir(curr);


}